import  requests
#requests.get(url)
from  lxml import  etree

#访问网址
response = requests.get('http://www.ygdy8.net/html/gndy/oumei/index.html')
#指定编码
response.encoding='gb2312'

#选择器selector
#提取文本
selector = etree.HTML(response.text)

items = selector.xpath('//div[@class="co_content8"]//tr[2]//td[2]//a[2]')

for item in items:
    print(item.xpath('./@href')[0])

    print(item.xpath('./text()')[0])
    ygdy_url ="http://www.ygdy8.net"+item.xpath('./@href')[0]
    print(ygdy_url)




#xpath 使用路径表达式在xml文档中进行导航
print(selector.xpath('//div[@class="bd3rr"]//img/@src')[0])
